package com.erp.pro.controller;

import com.erp.common.utils.PageUtils;
import com.erp.common.utils.Query;
import com.erp.pro.domain.InReportByGroupDO;
import com.erp.pro.domain.InReportBySkuDO;
import com.erp.pro.domain.OutreportskuDO;
import com.erp.pro.service.InReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @Auther: Eric
 * @Date: 2020-01-10 14:43
 * @Description:入库报表
 */
@Controller
@RequestMapping("/pro/inreport")
public class InReportController {

    @Autowired
    private InReportService inReportService;


    @GetMapping("/toinreportbysku")
    String toinreportbysku(){
        return "pro/inreport/inreportbysku";
    }

    @ResponseBody
    @GetMapping("/listbysku")
    public PageUtils listbysku(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<InReportBySkuDO> inReportBySkuDOList = inReportService.listbysku(query);
        int total = inReportService.countbysku(query);
        PageUtils pageUtils = new PageUtils(inReportBySkuDOList, total);
        return pageUtils;
    }


    @GetMapping("/toinreportbygroup")
    String toinreportbygroup(){
        return "pro/inreport/inreportbygroup";
    }

    @ResponseBody
    @GetMapping("/listbygroup")
    public PageUtils listbygroup(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<InReportByGroupDO> inReportByGroupDOList = inReportService.listbygroup(query);
        int total = inReportService.countbygroup(query);
        PageUtils pageUtils = new PageUtils(inReportByGroupDOList, total);
        return pageUtils;
    }

}
